<template>
  <div class="integrate">
    <h2>积分排行榜</h2>
    <ul>
      <li v-for="(v, i) in tableData" :key="i">
        <img :src="headPic(v)" alt="" />
        <p class="username">{{ v.userInfo.userName }}</p>
        <p class="">{{ v.userInfo.deptName }}</p>
        <p class="score">{{ v.score }}</p>
      </li>
    </ul>
  </div>
</template>
<script>
import { sysUserScoreQueryUserScoreList } from "@/api/admin/system/sysScoreRule";
export default {
  data() {
    return {
      listQuery: {
        page: 1,
        limit: 5,
      },
      tableData: [],
      pageObj: {},
    };
  },
  computed: {
    headPic() {
      return function (v) {
        if (v.userInfo.hasOwnProperty("sysAttachment")) {
          return v.userInfo.sysAttachment.httpUrl;
        } else {
          return this.$store.getters.headPic;
        }
      };
    },
  },
  mounted() {
    this.getList();
  },
  methods: {
    getList() {
      sysUserScoreQueryUserScoreList(this.listQuery).then((res) => {
        this.tableData = res.data.data;
        this.pageObj = res.data;
      });
    },
  },
};
</script>
<style scoped lang="scss">
.integrate {
  ul {
    li {
      height: 40px;
      line-height: 40px;
      clear: both;
      padding: 10px 0;
      border-bottom: 1px dashed #eee;
      img {
        float: left;
        width: 40px;
        height: 40px;
        border: 1px solid #eee;
        border-radius: 50%;
        display: inline;
        margin: 0 10px;
      }
      p {
        float: left;
      }
      .username {
        font-weight: bold;
        color: #333;
        margin-right: 10px;
      }
      .score {
        float: right;
        color: aqua;
      }
    }
  }
}
</style>